<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth:api');

Route::resource('posts', 'API\PostAPIController',['as'=>'api']);
Route::resource('categories', 'API\CategoryAPIController',['as'=>'api']);
Route::resource('comments', 'API\CommentAPIController',['as'=>'api']);
Route::resource('tags', 'API\TagAPIController',['as'=>'api']);


//$api = app('Dingo\Api\Routing\Router');

//app('Dingo\Api\Routing\UrlGenerator')->version('v1')->route('users.index');

//$api->version('v1', function ($api) {
//
//});
//
//$api->version('v1', function ($api) {
//    $api->group(['middleware' => 'foo'], function ($api) {
//        // Endpoints registered here will have the "foo" middleware applied.
//    });
//});
//$api->version('v1', function ($api) {
//    $api->get('users/{id}', 'App\Api\V1\Controllers\UserController@show');
//});
//
//$api->version('v2', function ($api) {
//    $api->get('users/{id}', 'App\Api\V2\Controllers\UserController@show');
//});


//Route::get('admin/categories', 'CategoryAPIController@index');
//Route::post('admin/categories', 'CategoryAPIController@store');
//Route::get('admin/categories/{categories}', 'CategoryAPIController@show');
//Route::put('admin/categories/{categories}', 'CategoryAPIController@update');
//Route::patch('admin/categories/{categories}', 'CategoryAPIController@update');
//Route::delete('admin/categories{categories}', 'CategoryAPIController@destroy');
//
//Route::get('admin/tags', 'TagAPIController@index');
//Route::post('admin/tags', 'TagAPIController@store');
//Route::get('admin/tags/{tags}', 'TagAPIController@show');
//Route::put('admin/tags/{tags}', 'TagAPIController@update');
//Route::patch('admin/tags/{tags}', 'TagAPIController@update');
//Route::delete('admin/tags{tags}', 'TagAPIController@destroy');
//
//Route::get('admin/comments', 'CommentAPIController@index');
//Route::post('admin/comments', 'CommentAPIController@store');
//Route::get('admin/comments/{comments}', 'CommentAPIController@show');
//Route::put('admin/comments/{comments}', 'CommentAPIController@update');
//Route::patch('admin/comments/{comments}', 'CommentAPIController@update');
//Route::delete('admin/comments{comments}', 'CommentAPIController@destroy');